/**
 * @file image_sensor.h
 * @brief
 *
 * Copyright (c) 2022 Bouffalolab team
 *
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.  The
 * ASF licenses this file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 *
 */
#ifndef __SC101IOT_H__
#define __SC101IOT_H__

#include "image_sensor.h"

static struct image_sensor_command_s sc101iot_init_list[] = {
    {0xf0, 0x30},
    {0x01, 0xff},
    {0x02, 0xe0},
    {0x30, 0x10},
    {0x3f, 0x81},
    {0xf0, 0x00},
    {0x70, 0x6b},
    {0x72, 0x30},
    {0x84, 0xb4},
    {0x8b, 0x00},
    {0x8c, 0x20},
    {0x8d, 0x02},
    {0x8e, 0xec},
    {0x9e, 0x10},
    {0xb0, 0xc1},
    {0xc8, 0x10},
    {0xc9, 0x10},
    {0xc6, 0x00},
    {0xe0, 0x0f},
    {0xb5, 0xf0},
    {0xde, 0x80},
    {0xb5, 0xf0},
    {0xde, 0x80},
    {0xb2, 0x50},
    {0xb3, 0xfc},
    {0xb4, 0x40},
    {0xb5, 0xc0},
    {0xb6, 0x50},
    {0xb7, 0xfc},
    {0xb8, 0x40},
    {0xb9, 0xc0},
    {0xba, 0xff},
    {0xbb, 0xcc},
    {0xbc, 0xa9},
    {0xbd, 0x7d},
    {0xc1, 0x77},
    //{0xf0, 0x01},
    //{0x70, 0x02},
    //{0x71, 0x02},
    //{0x72, 0x40},
    //{0x73, 0x02},
    //{0x74, 0x42},
    //{0x75, 0x20},
    {0xf0, 0x01},
    {0x70, 0x02},
    {0x71, 0x02},
    {0x72, 0x50},
    {0x73, 0x02},
    {0x74, 0xd2},
    {0x75, 0x20},
    {0x76, 0x81},
    {0x77, 0x8c},
    {0x78, 0x81},
    {0xf5, 0x00},
    {0xf6, 0x00},
    {0xf0, 0x36},
    {0x40, 0x03},
    {0x41, 0x01},
    {0xf0, 0x39},
    {0x02, 0x70},
    {0xf0, 0x32},
    {0x41, 0x00},
    {0x43, 0x01},
    {0x48, 0x02},
    {0xf0, 0x45},
    {0x09, 0x20},
    {0xf0, 0x33},
    {0x33, 0x10},
    {0xf0, 0x30},
    {0x38, 0x44},
    {0xf0, 0x39},
    {0x07, 0x00},
    {0x08, 0x19},
    {0x47, 0x00},
    {0x48, 0x00},
    {0xf4, 0x08},
    {0xf0, 0x37},
    {0x24, 0x31},
    {0xf0, 0x34},
    {0x9f, 0x02},
    {0xa6, 0x51},
    {0xa7, 0x57},
    {0xe8, 0x5f},
    {0xa8, 0x50},
    {0xa9, 0x50},
    {0xe9, 0x50},
    {0xf0, 0x33},
    {0xb3, 0x58},
    {0xb2, 0x78},
    {0xf0, 0x34},
    {0x9f, 0x03},
    {0xa6, 0x51},
    {0xa7, 0x57},
    {0xaa, 0x01},
    {0xab, 0x28},
    {0xac, 0x01},
    {0xad, 0x38},
    {0xf0, 0x33},
    {0x0a, 0x01},
    {0x0b, 0x28},
    {0xf0, 0x33},
    {0x64, 0x0f},
    {0xec, 0x51},
    {0xed, 0x57},
    {0x06, 0x58},
    {0xe9, 0x58},
    {0xeb, 0x68},
    {0xf0, 0x33},
    {0x64, 0x0f},
    {0xf0, 0x36},
    {0x70, 0xdf},
    {0xb6, 0x40},
    {0xb7, 0x51},
    {0xb8, 0x53},
    {0xb9, 0x57},
    {0xba, 0x5f},
    {0xb0, 0x84},
    {0xb1, 0x82},
    {0xb2, 0x84},
    {0xb3, 0x88},
    {0xb4, 0x90},
    {0xb5, 0x90},
    {0xf0, 0x36},
    {0x7e, 0x50},
    {0x7f, 0x51},
    {0x77, 0x81},
    {0x78, 0x86},
    {0x79, 0x89},
    {0xf0, 0x36},
    {0x70, 0xdf},
    {0x9c, 0x51},
    {0x9d, 0x57},
    {0x90, 0x54},
    {0x91, 0x54},
    {0x92, 0x56},
    {0xf0, 0x36},
    {0xa0, 0x51},
    {0xa1, 0x57},
    {0x96, 0x33},
    {0x97, 0x43},
    {0x98, 0x43},
    {0xf0, 0x36},
    {0x70, 0xdf},
    {0x7c, 0x40},
    {0x7d, 0x53},
    {0x74, 0xd0},
    {0x75, 0xf0},
    {0x76, 0xf0},
    {0xf0, 0x37},
    {0x0f, 0xd5},
    {0x7a, 0x40},
    {0x7b, 0x57},
    {0x71, 0x09},
    {0x72, 0x09},
    {0x73, 0x05},
    {0xf0, 0x33},
    {0x01, 0x44},
    {0xf0, 0x36},
    {0x37, 0xfb},
    {0xf0, 0x36},
    {0x3c, 0x0d},
    {0xf0, 0x33},
    {0x14, 0x95},
    {0xf0, 0x33},
    {0x8f, 0x80},
    {0xf0, 0x37},
    {0x27, 0x14},
    {0x28, 0x03},
    {0xf0, 0x36},
    {0x37, 0xf4},
    {0xf0, 0x33},
    {0x01, 0x44},
    {0xf0, 0x36},
    {0x79, 0x89},
    {0xf0, 0x34},
    {0xac, 0x01},
    {0xad, 0x40},
    {0xf0, 0x33},
    {0xeb, 0x70},
    {0xf0, 0x34},
    {0xa8, 0x50},
    {0xa9, 0x50},
    {0xf0, 0x33},
    {0xb3, 0x58},
    {0xf0, 0x36},
    {0x11, 0x80},
    {0xf0, 0x36},
    {0x41, 0x51},
    {0xf0, 0x3f},
    {0x03, 0x03},
    {0xf0, 0x36},
    {0xea, 0x09},
};

static struct image_sensor_config_s sc101iot_config = {
    .name = "SC101IOT",
    .output_format = IMAGE_SENSOR_FORMAT_YUV422_YUYV,
    .slave_addr = 0x68,
    .id_size = 1,
    .reg_size = 1,
    .h_blank = 320,
    .resolution_x = 1280,
    .resolution_y = 720,
    .id_addr = 0xf8,
    .id_value = 0x4a,
    .pixel_clock = 72000000,
    .init_list_len = sizeof(sc101iot_init_list)/sizeof(sc101iot_init_list[0]),
    .init_list = sc101iot_init_list,
};

#endif /* __SC101IOT_H__ */
